<?php

namespace app\factory\controller;

use app\common\respond\HttpApi;
use app\factory\logic\PigEatLogic;

class PigEatController
{
    /**
     * @Description 新增/编辑
     * @author: zj
     * @param HttpApi $respond
     * @time 2024/03/13 10:20:30
     * @return \think\response\Json
     */
    public function addEdit(HttpApi $respond)
    {
        $param = [
            'Id' => request()->post('Id'),
            'PigId' => request()->post('PigId'),
            'FeedName' => request()->post('FeedName'),
            'FeedWeight' => request()->post('FeedWeight'),
            'MedicineInfo' => request()->post('MedicineInfo'),
            'WaterRate' => request()->post('WaterRate'),
            'AllWeight' => request()->post('AllWeight'),
            'EatingTime' => request()->post('EatingTime'),
            'PreFeedDayId' => request()->post('PreFeedDayId'),
            'RecordTime' => request()->post('RecordTime'),
        ];
        $rule = [
            'Id' => 'require|integer|>:0',
            'RecordTime' => 'require|integer|>:0',
        ];
        validate($rule)->check($param);

        $logic = new PigEatLogic();
        $data = $logic->addEdit($param['Id'],$param);

        return $respond->success([]);
    }

}